package com.xsy.de.repositories;

import com.xsy.de.entity.IUser;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface IUserRepository extends Neo4jRepository<IUser, Long> {

    @Query("MATCH (n:IUser) RETURN n")
    List<IUser> findAllUserInfo();

    IUser findByName(@Param("name") String name);

    @Query("match (n:IUser),(n2:IUser),p=shortestpath((n)-[*]-(n2)) where n.name={name} and n2.skill={skill} return p")
    List<IUser> findUserSkill(@Param("name") String name, @Param("skill") String skill);
}
